#pragma once
//------------------------------------------------------------------------------
/**
    @class Characters::CharacterJoint
    
    Holds shared data of a character joint.
    
    (C) 2008 Radon Labs GmbH
*/
#include "core/types.h"
#include "util/stringatom.h"
#include "math/point.h"
#include "math/vector.h"
#include "math/quaternion.h"
#include "math/matrix44.h"
#include "modelnodewriter.h"
#include "COLLADAFWUniqueId.h"

//------------------------------------------------------------------------------
namespace Characters
{
class CharacterJoint
{
public:
    /// constructor
    CharacterJoint();
    /// destructor
    ~CharacterJoint();
    
    /// get the joint's name
    void SetName(const Util::StringAtom& jointName);
	/// set joint index
	void SetJointIndex(IndexT index);
	/// get the parent joint index
	IndexT GetJointIndex( ) const;
    /// get the parent joint index
    void SetParentJointIndex(IndexT index);
	/// get the parent joint index
	IndexT GetParentJointIndex() const;
    /// get pose translation
    void SetPoseTranslation(const Math::vector& poseTranslation);
	/// get pose translation
	const Math::vector& GetPoseTranslation();
    /// get pose rotation
    void SetPoseRotation(const Math::quaternion& poseRotation);
	/// get pose rotation
	const Math::quaternion& GetPoseRotation();
    /// get pose scale
    void SetPoseScale( const Math::vector& poseScale);
	/// get pose scale
	const Math::vector& GetPoseScale();
    /// get the pose matrix
    void SetPoseMatrix( const Math::matrix44& poseMatirx);
    /// get the inverse pose matrix
    void SetInvPoseMatrix(const Math::matrix44& InvposeMatirx);
	/// set joint unique id
	void SetJointUniqueId(const COLLADAFW::UniqueId& uniqueId);
	/// get joint unique id
	const COLLADAFW::UniqueId& GetJointUniqueId() const;
	/// set parent joint unique id
	void SetParentJointUniqueId(const COLLADAFW::UniqueId& uniqueId);
	/// get parent joint unique id
	const COLLADAFW::UniqueId& GetParentJointUniqueId() const;

	// write data to stream
	virtual bool WriteDataTag(Ptr<ToolkitUtil::ModelWriter>& writer);

private:
    Math::vector poseTranslation;
    Math::quaternion poseRotation;
    Math::vector poseScale;
    Math::matrix44 poseMatrix;
    Math::matrix44 invPoseMatrix;
    IndexT parentJointIndex;
    Util::StringAtom name;
	IndexT JointIndex;
	COLLADAFW::UniqueId JointUniqueId;
	COLLADAFW::UniqueId parentJointUniqueId;
};

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetName(const Util::StringAtom& jointName)
{
    this->name = jointName;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetJointIndex(IndexT index)
{
    this->JointIndex = index;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetParentJointIndex(IndexT index)
{
    this->parentJointIndex = index;
}

//------------------------------------------------------------------------------
/**
*/
inline IndexT 
CharacterJoint::GetParentJointIndex() const
{
	return this->parentJointIndex;
}

//------------------------------------------------------------------------------
/**
*/
inline IndexT 
CharacterJoint::GetJointIndex( ) const
{
	return this->JointIndex;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetPoseTranslation(const Math::vector& poseTranslation_)
{
    this->poseTranslation = poseTranslation_;
}

//------------------------------------------------------------------------------
/**
*/
inline 
const Math::vector& 
CharacterJoint::GetPoseTranslation()
{
	return this->poseTranslation;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetPoseRotation(const Math::quaternion& poseRotation_)
{
    this->poseRotation = poseRotation_;
}

//------------------------------------------------------------------------------
/**
*/
inline
const Math::quaternion& 
CharacterJoint::GetPoseRotation()
{
	return this->poseRotation;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetPoseScale( const Math::vector& poseScale_)
{
    this->poseScale = poseScale_;
}

//------------------------------------------------------------------------------
/**
*/
inline 
const Math::vector& 
CharacterJoint::GetPoseScale()
{
	return this->poseScale;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetPoseMatrix( const Math::matrix44& poseMatirx_)
{
    this->poseMatrix = poseMatirx_;
}

//------------------------------------------------------------------------------
/**
*/
inline void
CharacterJoint::SetInvPoseMatrix(const Math::matrix44& InvposeMatirx)
{
}

//------------------------------------------------------------------------------
/**
*/
inline void 
CharacterJoint::SetJointUniqueId(const COLLADAFW::UniqueId& uniqueId)
{
	this->JointUniqueId = uniqueId;
}

//------------------------------------------------------------------------------
/**
*/
inline const COLLADAFW::UniqueId& 
CharacterJoint::GetJointUniqueId() const
{
	return this->JointUniqueId;
}

//------------------------------------------------------------------------------
/**
*/
inline void 
CharacterJoint::SetParentJointUniqueId(const COLLADAFW::UniqueId& uniqueId)
{
	this->parentJointUniqueId = uniqueId;
}

//------------------------------------------------------------------------------
/**
*/
inline const COLLADAFW::UniqueId& 
CharacterJoint::GetParentJointUniqueId() const
{
	return this->parentJointUniqueId;
}

} // namespace Characters
//------------------------------------------------------------------------------
    